<!--
  ~ Copyright (c) 2020 the original author or authors
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      https://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  ~ or implied. See the License for the specific language governing
  ~ permissions and limitations under the License.
  -->

<div class="dialog" mat-dialog>
  <div mat-dialog-header class="dialog__header">
    <h1 mat-dialog-title>{{ 'common.create' | translate }} {{ data.entityType }}</h1>
  </div>
  <div mat-dialog-content class="dialog__content">
    <div class="dialog__content--form_field">
      <label>{{ data.placeholder }}</label>
      <input
        matInput
        cdkFocusInitial
        (input)="onChange(data.entityName)"
        [(ngModel)]="data.entityName"
        placeholder="{{ data.placeholder }}"
      />
      <mat-error *ngIf="alreadyExists">
        <small>{{ data.errorMsg }}</small>
      </mat-error>
    </div>
  </div>
  <div mat-dialog-actions class="dialog__actions">
    <button mat-flat-button [mat-dialog-close]="data.entityName" [disabled]="!data.entityName || alreadyExists">
      {{ 'common.capital.create' | translate | titlecase }}
    </button>
  </div>
  <button class="button-cross" mat-icon-button (click)="onCancelClick()">
    <mat-icon svgIcon="cross_new" inline="true"></mat-icon>
  </button>
</div>
